package org.kd.ssh.service;

import static org.junit.Assert.*;

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.kd.ssh.domain.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations="classpath:applicationContext.xml")
public class UserServiceTest {
	@Autowired
	private UserService userService;	

	@Test
	public void testLogin() {
		UserInfo userInfo = new UserInfo();
		userInfo.setUsername("admin");
		userInfo.setPassword("132456");
		UserInfo existUser = userService.login(userInfo);
		
		Assert.assertNull(existUser);
		
		UserInfo userInfo1 = new UserInfo();
		userInfo1.setUsername("admin");
		userInfo1.setPassword("admin");
		Assert.assertNotNull(userService.login(userInfo1));
	}

}
